import { View } from '@tarojs/components'
import { type CSSProperties, type FC } from 'react'

if (process.env.TARO_ENV !== 'h5') {
  require('@tarojs/taro/html5.css')
}

export interface HtmlViewProps {
  content?: string
  className?: string
  style?: string | CSSProperties
}

export const HtmlView: FC<HtmlViewProps> = (props) => {
  const { content, ...restProps } = props
  return <View {...restProps} dangerouslySetInnerHTML={{ __html: content ?? '' }} />
}

export default HtmlView
